/**
 * 路由配置
 *
 * 注：
 * iconCls: 'fa fa-id-card-o',//图标样式class   font-awesome: http://fontawesome.io/icons/
 *
 */
const Main = () => import('@/components/Main.vue');
const NoteFound = () => import('@/components/404.vue');
const Form = () => import('@/components/manage/nav1/Form.vue');
const SysLog = () => import('@/components/manage/system_manage/SysLog.vue');

const Login = () => import('@/components/Login.vue');
const Home = () => import('@/components/Home.vue');
import _CONSTANT from '../common/constant'

//系统管理员
const SysConfig = () => import('@/components/manage/system_manage/SysConfig.vue');
const UserManage = () => import('@/components/manage/UserManage.vue');
const SchoolMajorClass = () => import('@/components/manage/SchoolMajorClass.vue');
const ExerciseType = () => import('@/components/manage/ExerciseType.vue');
const ExerciseLevel = () => import('@/components/manage/ExerLevelManage.vue');


// 学生

const Courses = () => import('@/components/student/StuWelcome.vue');
const StudentExam = () => import('@/components/student/StudentExam.vue');
const StuCourseDetail =()=> import('@/components/student/StuCourseDetail.vue');
const TakeExam =()=> import('@/components/student/TakeExam.vue');
const OverExam=()=> import('@/components/student/OverExam.vue');
//教师
const TeachManage = () => import('@/components/teacher/TeachManage.vue');
const CourseManage = () => import('@/components/teacher/courseManage.vue');
const Cascader = () => import('@/components/teacher/CascaderTest.vue');
const Cyh =()=>import('@/components/teacher/cyhtest.vue')
const CourseDetail = () => import('@/components/teacher/CourseDetail.vue');
const Exampaper =() => import('@/components/teacher/Exampaper.vue');
const StudentCourse =()=> import('@/components/teacher/StudentCourse.vue');
const GradeTotal = ()=> import('@/components/teacher/GradeTotal.vue');
const ImportExercise =()=> import('@/components/teacher/ImportExercise.vue');
const Composepaper =()=> import('@/components/teacher/Composepaper.vue');
const Examination = () => import('@/components/teacher/Examination.vue');
const StudentGrade =()=>import('@/components/teacher/StudentGrade.vue');
const MarkPaper=()=>import('@/components/teacher/Markpaper.vue')

// 公共
const UpdatePWD = () => import('@/components/common/updatePWD.vue');
const PersonalInfo = () => import('@/components/common/personalInfo.vue');
const StudentWelcome=()=> import('@/components/student/StuWelcome.vue');
//修改密码（所有人均有权限）
const updatepwd = {
    path:'/home',
    component:Home,
    name:'修改密码',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","+_CONSTANT.TEACHER+","+_CONSTANT.STUDENT
    },
    children:[
        {path:'/updatepwd',name:"修改密码",component:UpdatePWD,meta:{permission:_CONSTANT.SYSTEM+","+_CONSTANT.TEACHER+","+_CONSTANT.STUDENT}}
    ]
};
//用户管理
const userManage = {
    path:'/usermanage',
    component:UserManage,
    name:'用户管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","
    }
};
//系统参数
const systemConfig = {
    path:'/sys_config',
    component:SysConfig,
    name:'参数管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","
    }
};
//院系管理
const schoolClassManage = {
    path:'/schoolclassmanage',
    component:SchoolMajorClass,
    name:'院系管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","
    }
};
//题型管理
const exerciseTypeManage = {
    path:'/exercisetypemanage',
    component:ExerciseType,
    name:'题型管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","
    }
};
//题目难度
const exerciseLevelManage = {
    path:'/exerciselevelmanage',
    component:ExerciseLevel,
    name:'题目难度',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.SYSTEM+","
    }
};

//个人信息
const personalInfo = {
    path:'/PersonalInfo',
    component:Home,
    name:'个人中心',
    children:[
        {path:'/personal',name:'个人中心',component:PersonalInfo,meta:{permission:_CONSTANT.STUDENT+","+_CONSTANT.TEACHER+","+_CONSTANT.SYSTEM,requireAuth:true}}
    ]
};

//学生欢迎页
const StuWelcome={
    path:'/stuWelcome',
    component:Home,
    name:'课程',
    children:[
        {path:'/welcome',name:'我的课程',component:StudentWelcome, meta:{
                requireAuth:true,
                permission:_CONSTANT.STUDENT+","
            }}
    ]
}
//学生的课堂
const studentCourse = {
    path:'/course',
    component:Courses,
    name:'我的课程',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.STUDENT+","
    }
};
//考试界面
const takeexam= {
    path:'/takeexam',
    component:TakeExam,
    name:'TakeExam',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.STUDENT+","
    }
};
//我的考试
const studentExam = {
    path:'/studentExam',
    component:StudentExam,
    name:'我的考试',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.STUDENT+","
    }
};
//学生端课程详情
const stuCourseDetail = {
    path:'/stuCourseDetail',
    component:StuCourseDetail,
    name:'课程详情',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.STUDENT+","
    }
};
const overExam={
  path:'/overExam',
  component:OverExam,
  name:'考试结束',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.STUDENT+","
    }
};
//教师课程管理
const courseManage = {
    path:'/courseManage',
    component:CourseManage,
    name:'课程管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
//授课管理
const teachManage = {
    path:'/teachManage',
    component:TeachManage,
    name:'授课管理',
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+','
    }
};

//课程详细情况
const courseDetail = {
    path:'/CourseDetail',
    component:CourseDetail ,
    name:'CourseDetail',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};

//试卷管理
const exampaper= {
    path:'/exampaper',
    component:Exampaper,
    name:'Exampaper',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
//学生管理
const studentcourse= {
    path:'/studentcourse/',
    component:StudentCourse,
    name:'StudentCourse',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
//组卷
const composePaper= {
    path:'/composepaper',
    component:Composepaper,
    name:'Composepaper',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
const gradetotal= {
    path:'/gradetotal',
    component:GradeTotal,
    name:'成绩统计',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
const studentgrade= {
    path:'/studentgrade',
    component:StudentGrade,
    name:'学生成绩详情',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
//考试
const examination= {
    path:'/examination',
    component:Examination,
    name:'examination',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};
//批改试卷
const markpaper={
    path:'/markpaper',
    component:MarkPaper,
    name:'markpaper',
    hidden:true,
    meta:{
        requireAuth:true,
        permission:_CONSTANT.TEACHER+","
    }
};

/*系统管理员*/
const system_manage = {
    path:'/system',
    component:Home,
    name:'系统管理',
    iconCls:'el-icon-setting',
    permission:_CONSTANT.SYSTEM+",",
    leaf:false,
    children:[
        systemConfig,
        userManage,
        schoolClassManage,
        exerciseTypeManage,
        exerciseLevelManage
    ]
};

/**
 * 学生
 * @type {{path: string, component: function(), name: string, iconCls: string, permission: string, leaf: boolean, children: *[]}}
 */
//教师端学生关联课程
const course_student = {
    path:'/student',
    component:Home,
    name:'课堂',
    iconCls:'el-icon-menu',
    permission:_CONSTANT.STUDENT+",",
    leaf:true,
    children:[
        studentCourse,
        stuCourseDetail,
    ]
};

//学生端我的考试
const exam_student = {
    path:'/student',
    children:[
        studentExam,
        takeexam,
        overExam,
    ],
    component:Home,
    name:'我的考试',
    iconCls:'el-icon-edit-outline',
    permission:_CONSTANT.STUDENT+",",
    leaf:true,

};

//教师端试题导入
const importexercise={
    path:'/importexercise',
    component:ImportExercise,
    name:'试题导入',
    iconCls:'el-icon-edit-outline',
    permission:_CONSTANT.TEACHER+",",
    leaf:false,

}

//教师端课程管理
const teacherCourses = {
    path:'/teacher',
    component:Home,
    name:'课程管理',
    iconCls:'el-icon-menu',
    permission:_CONSTANT.TEACHER+",",
    leaf:true,
    children:[
        courseManage,
        courseDetail,
        exampaper,
        gradetotal,
        importexercise,
        composePaper,
        examination,
        studentgrade,
    ]
};

//教师授课
const teachManages={
    path:'/teacher',
    component:Home,
    name:'授课管理',
    iconCls:'el-icon-menu',
    permission:_CONSTANT.TEACHER+",",
    leaf:true,
    children:[
        teachManage,
        studentcourse,
        markpaper,
    ]
};

const cascader = {
    path:'/test',
    component:Home,
    name:'授课管理',
    iconCls:'el-icon-menu',
    permission:_CONSTANT.TEACHER+",",
    leaf:true,
    children:[
        {path:'/cascader',name:'test',component:Cascader,meta:{permission:_CONSTANT.TEACHER+",",requireAuth:true}}
    ]
};
const cyh = {
    path:'/cyhtest',
    component:Home,
    name:'授课管理',
    iconCls:'el-icon-menu',
    permission:_CONSTANT.TEACHER+",",
    leaf:true,
    children:[
        {path:'/cyh',name:'cyhtest',component:Cyh,meta:{permission:_CONSTANT.TEACHER+",",requireAuth:true}}
    ]
};


const login_Route = {
    path: '/login',
    component: Login,
    name: '用户登录',
    hidden: true,
    meta:{
        requireAuth:false
    }
};
const router_Default = {
    path:'/',
    redirect:'/login'
};
const notFound = {
    name:"404",
    path:"*",
    component:NoteFound
};

let routes = [
    router_Default,
    login_Route,
    //公共
    personalInfo,
    StuWelcome,
    updatepwd,

    system_manage,
    course_student,
    teacherCourses,
    teachManages,
    exam_student,
   cascader,
    cyh,
    notFound,
];


export default routes;
